<template>
  <el-dialog :title="info.title" :visible.sync="visible" append-to-body center width="460px" :before-close="handleCancel">
    <el-form ref="formDate" label-suffix=":" label-width="100px" :rules="rules" :model="form">
      <el-row>
        <el-col :span="24">
          <el-form-item label="登录密码" prop="password" style="width: 100%">
            <el-input v-model="form.password" type="password" size="small" clearable />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="24">
          <div class="fr mt10">
            <el-button size="small" @click="handleCancel()">取 消</el-button>
            <el-button type="primary" size="small" @click="handlePassword()">确 认</el-button>
          </div>
        </el-col>
      </el-row>
    </el-form>
  </el-dialog>
</template>

<script>
import page from '@/utils/page'
import { flogin } from '@/api/finance/fpassword'

export default {
  extends: page,
  data() {
    return {
      rules: {
        password: [{ required: true, trigger: 'blur', message: '登录密码不可为空' }]
      }
    }
  },
  watch: {
    visible(val) {
      if (val) {
        this.form = this.info.edit
      }
    }
  },
  mounted() {
  },
  methods: {
    handlePassword() {
      this.$refs['formDate'].validate(async(valid) => {
        flogin(this.form).then(response => {
          this.refreshParent()
        }).catch(err => {
          this.$message.error(err.msg)
        })
      })
    }
  }
}
</script>

<style>

</style>
